TextView—Avoid pointless Pango in iter_line_is_rtl
authorDaniel Boles <dboles@src.gnome.org>
Wed, 22 Feb 2017 21:24:48 +0000 (21:24 +0000)
committerDaniel Boles <dboles@src.gnome.org>
Wed, 22 Feb 2017 21:28:13 +0000 (21:28 +0000)
Get the direction that was already worked out and stored in the
TextLineDisplay, rather than making Pango figure it out again.

https://bugzilla.gnome.org/show_bug.cgi?id=136059

gtk/gtktextview.c

index 1e937385370c621e969b79f4cf80e9ad6294045f..41db8bcc358a11d4934982806602f1a444217273 100644 (file)
@@ -6348,12 +6348,11 @@ iter_line_is_rtl (GtkTextIter *iter, GtkTextLayout *layout)
 {
   GtkTextLine *line = _gtk_text_iter_get_text_line (iter);
   GtkTextLineDisplay *display = gtk_text_layout_get_line_display (layout, line, FALSE);
-  const gchar *text = pango_layout_get_text (display->layout);
-  PangoDirection pango_dir = pango_find_base_dir (text, -1);
+  GtkTextDirection direction = display->direction;
 
   gtk_text_layout_free_line_display (layout, display);
 
-  return pango_dir == PANGO_DIRECTION_RTL;
+  return direction == GTK_TEXT_DIR_RTL;
 }
 
 static void